define(['angular'], function(angular){
    return ['$http', function ($http){
        var factory = {};
        factory.images = [];
        factory.load = function() {
            this.images = $http.get('./data/images.json').then(function(data) {
                return data;
            });
            return this.images;
        };
        factory.getImages = function() {
            return this.images.length === 0 ? this.load() : this.images;
        };

        return factory;
    }];
});